package com.joysuch.wwyt.mh.enums;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

public enum AlarmLevelNameEnum {

    BLUE(1,"蓝"),
    YELLOW(2,"黄"),
    ORANGE(3,"橙"),
    RED(4,"红");

    private Integer type;
    private String desc;

    AlarmLevelNameEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    private static final Map<Integer, AlarmLevelNameEnum> lookup = new HashMap<>();

    static {
        for (AlarmLevelNameEnum e : EnumSet.allOf(AlarmLevelNameEnum.class)) {
            lookup.put(e.type, e);
        }
    }

    public static AlarmLevelNameEnum find(Integer type) {
        if(null == type){
            return null;
        }
        return lookup.get(type);
    }

}
